#delimit ;
set more off;

/*NOTE: For a Mac, file path names use a forward slash (/) but for 
PC's they require a backward slash (\). Make these changes below 
if necessary depending on your computer type. Also, install the estout 
command if you haven't already done so:
ssc install estout
*/

*Dropbox paths by user;
if c(username)=="shayaksarkar" {;
	local path "/Users/shayaksarkar/Desktop/ReStat_Data_Publication";
};

if c(username)=="fatimawagdy" {;
	local path "/Users/fatimawagdy/Dropbox/00_ReStat_Data_Publication";
};

/*TABLE 6*/;

cd `path';

use "`path'/final_disclosure.dta", clear;

keep if post!=.;

local se cluster(date_auditor);

local controls agent_home auditor_home auditor_office other_venue;

reg anyulip post disclosureknowledge postdk, `se';
	estadd ysumm;
	eststo;

areg anyulip post disclosureknowledge postdk govt_under `controls', absorb(ms_id) `se';
	estadd ysumm;
	eststo;

** Gov't and non-govt seperately;

areg anyulip post disclosureknowledge postdk `controls' if govt_underwriter==1 , absorb(ms_id) `se';
	estadd ysumm;
	eststo;

areg anyulip post disclosureknowledge postdk `controls' if govt_underwriter==0 , absorb(ms_id) `se';
	estadd ysumm;
	eststo;

** Term and Whole;

areg anyterm post disclosureknowledge postdk govt_under `controls', absorb(ms_id) `se';
	estadd ysumm;
	eststo;

areg anywhole post disclosureknowledge postdk govt_under `controls', absorb(ms_id) `se';
	estadd ysumm;
	eststo;
	
** Risk Cover and Premium;	
	
areg ln_trc post disclosureknowledge postdk govt_under `controls', absorb(ms_id) `se';
	estadd ysumm;
	eststo;

areg ln_tpr post disclosureknowledge postdk govt_under `controls', absorb(ms_id) `se';
	estadd ysumm;
	eststo;


* Output to Excel file;
esttab est1 est2 est3 est4 est5 est6 est7 est8 using "`path'/out/table6.csv", replace 
cells("b(fmt(5)) _star" se(fmt(5) )) starlevels(* .1 ** .05 *** .01) 
stats (ymean N, fmt( 5 %12.0fc) label("Dep. Var. Mean" N )) plain;
eststo clear;


